var app = getApp()
var ddapi = require('../../../utils/md5.js');
Page({
  data: {
    dpList: [],
    dp: {},
    length: 0,
    shop_id: 0
  },
  onLoad: function (options) {
    var that = this
    that.getShop();
  },

  getShop: function () {
    var that = this
    var service = 'User.GetMyShop';
    var openid = wx.getStorageSync('openid');
    var user_id = wx.getStorageSync('user_id');
    var shop_id = that.data.shop_id;
    var sign = ddapi.md5(openid + service + shop_id + user_id);
    var orderList = that.data.orderList;
    wx.request({
      url: app.globalData.apiUrl + '?service=User.GetMyShop',
      header: {
        'Content-Type': 'json'
      },
      data: {
        sign: sign,
        open_id: openid,
        user_id: user_id,
        shop_id: shop_id
      },
      success: function (res) {
        console.log(res)
        if (res.data.data.code == 0) {
          var info = res.data.data.info;
          console.log(orderList);
          that.setData({
            dpList: info,
            length: info.length,
            dp: info[0],
          });
        }
      }
    })
  },
})